package sketch.generator;

import sketch.SMethod;
import sketch.SketchSequence;
import sketch.ValueChoice;
import sketch.subject.TreeMap;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;


public class SingleSequenceGeneratorTest extends TestCase {
	
	public static Test suite() {
        return new TestSuite(SingleSequenceGeneratorTest.class);
    }
	
	public void setUp() {
		GenTests.reset(TreeMap.class);
	}
	
	public void testSingleSequence() {
		System.out.println("executing testSingleSequence");
		TreeMap tree = new TreeMap();
		SMethod smethod = SMethod.instance(tree, "put(int)");
		ValueGenerator<Integer> valueGen = ValueChoice.getIntPool(1, 1, 1); 
		SequenceGenerator<SketchSequence> seqGen = new SingleSequenceGenerator<SketchSequence>(tree, smethod, valueGen);
		while(seqGen.hasNext()) {
			seqGen.next();
			System.out.println(seqGen.getGeneratedSequence());
		}
		System.out.println();
	}
	
	public void testInorderSequence() {
		System.out.println("executing testInorderSequence");
		TreeMap tree = new TreeMap();
		SMethod smethod = SMethod.instance(tree, "put(int)");
		ValueGenerator<Integer> valueGen = ValueChoice.getIntPool(5, 1, 20); 
		SequenceGenerator<SketchSequence> seqGen = new InorderSequenceGenerator<SketchSequence>(tree, smethod, valueGen);
		while(seqGen.hasNext()) {
			seqGen.next();
			System.out.println(seqGen.getGeneratedSequence());
		}
		System.out.println();
	}
	
	public void testRepeatedSequence() {
		System.out.println("executing testRepeatedSequence");
		TreeMap tree = new TreeMap();
		SMethod smethod = SMethod.instance(tree, "put(int)");
		ValueGenerator<Integer> valueGen = ValueChoice.getIntPool(1, 1, 20); 
		
		SequenceGenerator<SketchSequence> seqGen = new RepeatSequenceGenerator<SketchSequence>(tree, smethod, valueGen, 6);
		while(seqGen.hasNext()) {
			seqGen.next();
			System.out.println(seqGen.getGeneratedSequence());
		}
		System.out.println();
	}
	
}
